import java.util.Vector;


public class Bank 
{
	/**
	 * bank name
	 */
	private String fName;
	/**
	 * vector that is used to store checking accounts.
	 */
	private Vector<CheckingAccount> fCheckingAccounts;
	/**
	 * vector that is used to store savings accounts
	 */
	private Vector<SavingsAccount> fSavingAccounts;
	
	/**
	 * creates a bank
	 * @param name the name of the bank
	 */
	public Bank(String name)
	{
		fName = name;
		fCheckingAccounts = new Vector<CheckingAccount>();
		fSavingAccounts = new Vector<SavingsAccount>();
	}
	
	/**
	 * gets the name of current bank.
	 * @return name of current bank
	 */
	public String getBankName() {
		return fName;
	}
	/**
	 * creates a savings account using static information
	 */
	public void openSimpleSavingsAccount()
	{
		fSavingAccounts.add(new SavingsAccount("Bob Smith", "1 Main St.", "12345", "Tacoma", "USA", 123456));
	}
	
	/**
	 * creates a savings account based on passed in parameters
	 * @param name the savings account owner's name
	 * @param street the savings account owner's street
	 * @param zipCode the savings account owner's town zip code
	 * @param town the savings account owner's town
	 * @param country the savings account owner's country
	 * @param savingsAccountNumber the savings account number tied to this account
	 */
	public void openSimpleSavingsAccount(String name, String street, String zipcode, String town, String country, int savingsAccountNumber)
	{
		fSavingAccounts.add(new SavingsAccount(name, street, zipcode, town, country, savingsAccountNumber));
	}
	
	/**
	 * creates a checking account account using static information
	 */
	public void openSimpleCheckingAccount()
	{
		fCheckingAccounts.add(new CheckingAccount("Bob Smith", "1 Main St.", "12345", "Tacoma", "USA", 123456));
	}
	
	/**
	 * creates a simple checking account
	 * @param name the checking account owner's name
	 * @param street the checking account owner's street
	 * @param zipCode the checking account owner's town zip code
	 * @param town the checking account owner's town
	 * @param country the checking account owner's country
	 * @param checkingAccountNumber the checking account number tied to this account
	 */
	public void openSimpleCheckingAccount(String name, String street, String zipcode, String town, String country, int checkingAccountNumber)
	{
		fCheckingAccounts.add(new CheckingAccount(name, street, zipcode, town, country, checkingAccountNumber));
	}
	/**
	 *creates a savings account and checking account using static information
	 */
	public void openFullPackage()
	{
		fCheckingAccounts.add(new CheckingAccount("Bob Smith", "1 Main St.", "12345", "Tacoma", "USA", 123456));
		fSavingAccounts.add(new SavingsAccount("Bob Smith", "1 Main St.", "12345", "Tacoma", "USA", 123456));
	}
	/**
	 * creates a savings account and simple checking account
	 * @param name the savings account and simple checking account owner's name
	 * @param street the savings account and simple checking account owner's street
	 * @param zipCode the savings account and simple checking account owner's town zip code
	 * @param town the savings account and simple checking account owner's town
	 * @param country the savings account and simple checking account owner's country
	 * @param savingsAccountNumber the savings account number tied to this account 
	 * @param checkingAccountNumber the checking account number tied to this account

	 */
	public void openFullPackage(String name, String street, String zipCode, String town, String country, int savingsAccountNumber, int checkingAccountNumber)
	{
		fCheckingAccounts.add(new CheckingAccount(name, street, zipCode, town, country, checkingAccountNumber));
		fSavingAccounts.add(new SavingsAccount(name, street, zipCode, town, country, savingsAccountNumber));
	}
	
	/**
	 * gets checking account associated to accountNumber
	 * @param accountNumber number associated with account
	 * @return account associated to accountNumber or null
	 */
	public CheckingAccount getCheckingAccount(int accountNumber) {
		for(CheckingAccount account : fCheckingAccounts) {
			if(account.getAccountNumber() == accountNumber) {
				return account;
			} else {
				return null;
			}
		}
		return null;	
	}
	/**
	 * gets savings account associated to accountNumber
	 * @param accountNumber number associated with account
	 * @return account associated to accountNumber or null
	 */
	public SavingsAccount getSavingsAccount(int accountNumber) {
		for(SavingsAccount account : fSavingAccounts) {
			if(account.getAccountNumber() == accountNumber) {
				return account;
			} else {
				return null;
			}
		}
		return null;
	}
	
}
